﻿//---------------------------------------------------------------------------------
// Copyright 2011 Microsoft Corporation
// Licensed under the Microsoft Public License (MS-PL) (the "License"); 
// You may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.opensource.org/licenses/ms-pl.html
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR 
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
// INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
// See the Microsoft Public License (MS-PL) for the specific language governing 
// permissions and limitations under the License.
//---------------------------------------------------------------------------------
using System;
using System.Collections.ObjectModel;
using System.Data.Services.Common;

namespace Microsoft.Telco.WindowsLive
{
	[EntitySet("AllContacts"), EntityPropertyMapping("ThumbnailImage", SyndicationItemProperty.LinkHref, SyndicationTextContentKind.Plaintext, false, "rel", "http://schemas.microsoft.com/ado/2007/08/dataservices/mediaresource/ThumbnailImage"), DataServiceKey("Id")]
	public class Contact : LiveResource
	{
		// Fields
		private DateTime _Birthday;
		private ObservableCollection<CategoryInfo> _Categories = new ObservableCollection<CategoryInfo>();
		private string _Cid;
		private string _FirstName;
		private string _FormattedName;
		private string _HonorificPrefix;
		private string _HonorificSuffix;
		private bool _IsFriend;
		private bool _IsIMEnabled;
		private string _JobTitle;
		private string _LastName;
		private string _MiddleName;
		private Uri _ThumbnailImage;
		private string _WindowsLiveID;


		// Properties
		public DateTime Birthday
		{
			get
			{
				return this._Birthday;
			}
			set
			{
				this._Birthday = value;
				this.OnPropertyChanged("Birthday");
			}
		}

		public ObservableCollection<CategoryInfo> Categories
		{
			get
			{
				return this._Categories;
			}
			set
			{
				if (value != null)
				{
					this._Categories = value;
				}
			}
		}

		public string Cid
		{
			get
			{
				return this._Cid;
			}
			internal set
			{
				this._Cid = value;
				this.OnPropertyChanged("Cid");
			}
		}

		public string FirstName
		{
			get
			{
				return this._FirstName;
			}
			set
			{
				this._FirstName = value;
				this.OnPropertyChanged("FirstName");
			}
		}

		public string FormattedName
		{
			get
			{
				return this._FormattedName;
			}
			internal set
			{
				this._FormattedName = value;
				this.OnPropertyChanged("FormattedName");
			}
		}

		public string HonorificPrefix
		{
			get
			{
				return this._HonorificPrefix;
			}
			set
			{
				this._HonorificPrefix = value;
				this.OnPropertyChanged("HonorificPrefix");
			}
		}

		public string HonorificSuffix
		{
			get
			{
				return this._HonorificSuffix;
			}
			set
			{
				this._HonorificSuffix = value;
				this.OnPropertyChanged("HonorificSuffix");
			}
		}

		public bool IsFriend
		{
			get
			{
				return this._IsFriend;
			}
			internal set
			{
				this._IsFriend = value;
				this.OnPropertyChanged("IsFriend");
			}
		}

		public bool IsIMEnabled
		{
			get
			{
				return this._IsIMEnabled;
			}
			set
			{
				this._IsIMEnabled = value;
				this.OnPropertyChanged("IsIMEnabled");
			}
		}

		public string JobTitle
		{
			get
			{
				return this._JobTitle;
			}
			set
			{
				this._JobTitle = value;
				this.OnPropertyChanged("JobTitle");
			}
		}

		public string LastName
		{
			get
			{
				return this._LastName;
			}
			set
			{
				this._LastName = value;
				this.OnPropertyChanged("LastName");
			}
		}

		public string MiddleName
		{
			get
			{
				return this._MiddleName;
			}
			set
			{
				this._MiddleName = value;
				this.OnPropertyChanged("MiddleName");
			}
		}

		public Uri ThumbnailImage
		{
			get
			{
				return this._ThumbnailImage;
			}
			internal set
			{
				this._ThumbnailImage = value;
				this.OnPropertyChanged("ThumbnailImage");
			}
		}

		internal string UtcOffset { get; set; }

		public string WindowsLiveID
		{
			get
			{
				return this._WindowsLiveID;
			}
			set
			{
				this._WindowsLiveID = value;
				this.OnPropertyChanged("WindowsLiveID");
			}
		}
	}

}
